import React from "react";
// 定义一个APP 组件包裹所有的页面
import App from './App'
import {
    HashRouter as Router,
    Route,
    Switch,
    Redirect
} from "react-router-dom";

import Login from './pages/login'
import Admin from './admin';
import Home from './pages/home'
import Buttons from './pages/UI/button'
import NoMatch from './pages/UI/noMatch'
import Modals from './pages/UI/modals'
import Loadings from './pages/UI/loadings'
import Notices from './pages/UI/notice'
import Messages from './pages/UI/messages'
import Tabss from './pages/UI/tabs'
import Gallerys from './pages/UI/gallery'
import Carousels from './pages/UI/carousel'
import Logins from './pages/Form/login'
import Registers from './pages/Form/register'
import BaseTable1 from './pages/Tables/basicTable01'
import BaseTable from './pages/Tables/basicTable'
import HeightTable from './pages/Tables/heightTable'
import City from './pages/city'
import Order from './pages/order'
import Common from './common'
import Detail from './pages/order/detail'
import Users from './pages/users'
import BikeMAP from './pages/map'
import Permission from './pages/permission'

class IRouter extends React.Component {
    render() {
        return (
            <Router>
                {/* App 容纳所有组件 */}
                <App>
                    <Switch>
                        <Route path="/login" component={Login} />
                        <Route path="/common" render={() =>
                            <Common>
                                <Route path="/common/order/detail/:orderId" component={Detail} />
                            </Common>
                        }
                        />
                        <Route path="/" render={() =>
                            <Admin>
                                <Switch>
                                    <Route path="/home" component={Home} />
                                    <Route path="/ui/buttons" component={Buttons} />
                                    <Route path="/ui/modals" component={Modals} />
                                    <Route path="/ui/loadings" component={Loadings} />
                                    <Route path="/ui/notification" component={Notices} />
                                    <Route path="/ui/messages" component={Messages} />
                                    <Route path="/ui/tabs" component={Tabss} />
                                    <Route path="/ui/gallery" component={Gallerys} />
                                    <Route path="/ui/carousel" component={Carousels} />
                                    <Route path="/form/login" component={Logins} />
                                    <Route path="/form/reg" component={Registers} />
                                    <Route path="/table/basic" component={BaseTable} />
                                    <Route path="/table/text" component={BaseTable1} />
                                    <Route path="/table/high" component={HeightTable} />
                                    <Route path="/rich" component={Carousels} />
                                    <Route path="/city" component={City} />
                                    <Route path="/order" component={Order} />
                                    <Route path="/user" component={Users} />
                                    <Route path="/bikeMap" component={BikeMAP} />
                                    <Route path="/permission" component={Permission} />
                                    <Route path="/charts/bar" component={Carousels} />
                                    <Redirect to="/home" />
                                    <Route component={NoMatch} />
                                </Switch>
                            </Admin>
                        } />
                    </Switch>
                </App>

            </Router>
        )
    }
}

export default IRouter